<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org/">
<head>
    <meta charset="utf-8">
    <base th:href="${#request.getContextPath()}+'/'">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>Bootstrap 101 Template</title>

    <!-- Bootstrap -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">

    <!-- HTML5 shim 和 Respond.js 是为了让 IE8 支持 HTML5 元素和媒体查询（media queries）功能 -->
    <!-- 警告：通过 file:// 协议（就是直接将 html 页面拖拽到浏览器中）访问页面时 Respond.js 不起作用 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
    <![endif]-->

    <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
    <script src="js/jquery-3.1.1.js"></script>
    <!--<script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>-->
    <!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
    <script src="js/bootstrap-treeview.js"></script>
    <link href="css/bootstrap-treeview.css">
    <link href="css/default.css">
    <link href="css/normalize.css">
    <script type="text/javascript" src="http://cdn-hangzhou.goeasy.io/goeasy.js"></script>
    <script type="text/javascript">
        var orderNum=0;
        var goEasy = new GoEasy({
            appkey: 'BC-68b41d3031624912b43cd30ef3854110'
        });
        goEasy.subscribe({
            channel:'merchant',
            onMessage:function (message) {
                alert("你有新订单待处理");
                orderNum=orderNum+1;

                var data = [
                    {
                        text: '系统首页',
                        href: '#parent1',
                        tags: ['0']
                    },
                    {
                        text: '商品管理',
                        href: '#parent2',
                        tags: ['4'],
                        nodes: [
                            {
                                text: '商品信息',
                                href: 'product/find',
                                tags: ['2'],
                            },
                            {
                                text: '增加商品',
                                href: 'product/list',
                                tags: ['0']
                            },
                            {
                                text: '商品文案',
                                href: '#child3',
                                tags: ['0']
                            },
                            {
                                text: '增加微信文案',
                                href: '#child4',
                                tags: ['0']
                            },
                            {
                                text: '增加站内文案',
                                href: '#child5',
                                tags: ['0']
                            },
                            {
                                text: '增加空间文案',
                                href: '#child6',
                                tags: ['0']
                            }
                        ]
                    },
                    {
                        text: '订单管理',
                        href: '#parent3',
                        tags: [orderNum],
                        nodes: [
                            {
                                text: '全部订单',
                                href: '#child7',
                                tags: ['2'],
                            },
                            {
                                text: '已下单订单',
                                href: '#child8',
                                tags: ['0']
                            },
                            {
                                text: '待跟进订单',
                                href: '#child9',
                                tags: ['0']
                            },
                            {
                                text: '待发货订单',
                                href: '#child10',
                                tags: ['0']
                            },
                            {
                                text: '已取消订单',
                                href: '#child11',
                                tags: ['0']
                            },
                            {
                                text: '已发货订单',
                                href: '#child12',
                                tags: ['0']
                            },
                            {
                                text: '已结算订单',
                                href: '#child13',
                                tags: ['0']
                            },
                            {
                                text: '已拒收订单',
                                href: '#child14',
                                tags: ['0']
                            },
                            {
                                text: '已签收订单',
                                href: '#child15',
                                tags: ['0']
                            },
                            {
                                text: '已退货订单',
                                href: '#child16',
                                tags: ['0']
                            }
                        ]
                    },
                    {
                        text: '统计报表',
                        href: '#parent4',
                        tags: ['0'],
                        nodes: [
                            {
                                text: '商品销售统计',
                                href: '#child17',
                                tags: ['2'],
                            }
                        ]
                    },
                    {
                        text: '财务管理',
                        href: '#parent5',
                        tags: ['0'],
                        nodes: [
                            {
                                text: '待结算流水',
                                href: '#child18',
                                tags: ['2'],
                            },
                            {
                                text: '已结算流水',
                                href: '#child19',
                                tags: ['2'],
                            },
                            {
                                text: '已返款流水',
                                href: '#child20',
                                tags: ['2'],
                            },
                            {
                                text: '财务返款单',
                                href: '#child21',
                                tags: ['2'],
                            },
                            {
                                text: '支付宝记录',
                                href: '#child22',
                                tags: ['2'],
                            },
                        ]
                    },
                    {
                        text: '用户管理',
                        href: '#parent6'  ,
                        tags: ['0'],
                        nodes: [
                            {
                                text: '基本信息',
                                href: '#child23',
                                tags: ['2'],
                            },
                            {
                                text: '修改密码',
                                href: '#child24',
                                tags: ['2'],
                            }
                        ]
                    }
                ];
                $("#functree").treeview({
                    levels:1,
                    showTags:true,
                    data:data
                });

                /*默认选择指定的item*/
                $('#functree').treeview('selectNode', [11, { silent: true }]);
                /*展开指定的item*/
                $('#functree').treeview('expandNode',[8, {silent:true, ignoreChildren: false}]);
                /*点击事件*/
                $("#functree").on("nodeSelected",function(event,data){
                    $("#content").load(data.href);
                });
            }
        })
    </script>
</head>
<body>
<nav class="navbar navbar-default">
    <div class="container-fluid">
        <div class="navbar-header">
            <a class="navbar-brand" href="#">
                <span class="glyphicon glyphicon-user"></span>
            </a>
        </div>
    </div>
</nav>
<div class="container-fluid">
    <!--功能树-->
    <div id="functree" class="col-md-2"></div>
    <div id="content"  class="col-md-10">
        <h1>欢迎管理回来~</h1>
        <!--<div class="panel panel-default">
            <div id="content" class="panel-body">
                <h1>欢迎管理回来~</h1>
            </div>
        </div>-->

    </div>
</div>


<script>
    /*页面加载直接执行此方法*/
    $(function () {
        var data = [
            {
                text: '系统首页',
                href: '#parent1',
                tags: ['0']
            },
            {
                text: '商品管理',
                href: '#parent2',
                tags: ['4'],
                nodes: [
                    {
                        text: '商品信息',
                        href: 'product/find',
                        tags: ['2'],
                    },
                    {
                        text: '增加商品',
                        href: 'product/list',
                        tags: ['0']
                    },
                    {
                        text: '商品文案',
                        href: '#child3',
                        tags: ['0']
                    },
                    {
                        text: '增加微信文案',
                        href: '#child4',
                        tags: ['0']
                    },
                    {
                        text: '增加站内文案',
                        href: '#child5',
                        tags: ['0']
                    },
                    {
                        text: '增加空间文案',
                        href: '#child6',
                        tags: ['0']
                    }
                ]
            },
            {
                text: '订单管理',
                href: '#parent3',
                tags: ['0'],
                nodes: [
                    {
                        text: '全部订单',
                        href: '#child7',
                        tags: ['2'],
                    },
                    {
                        text: '已下单订单',
                        href: '#child8',
                        tags: ['0']
                    },
                    {
                        text: '待跟进订单',
                        href: '#child9',
                        tags: ['0']
                    },
                    {
                        text: '待发货订单',
                        href: '#child10',
                        tags: ['0']
                    },
                    {
                        text: '已取消订单',
                        href: '#child11',
                        tags: ['0']
                    },
                    {
                        text: '已发货订单',
                        href: '#child12',
                        tags: ['0']
                    },
                    {
                        text: '已结算订单',
                        href: '#child13',
                        tags: ['0']
                    },
                    {
                        text: '已拒收订单',
                        href: '#child14',
                        tags: ['0']
                    },
                    {
                        text: '已签收订单',
                        href: '#child15',
                        tags: ['0']
                    },
                    {
                        text: '已退货订单',
                        href: '#child16',
                        tags: ['0']
                    }
                ]
            },
            {
                text: '统计报表',
                href: '#parent4',
                tags: ['0'],
                nodes: [
                    {
                        text: '商品销售统计',
                        href: '#child17',
                        tags: ['2'],
                    }
                ]
            },
            {
                text: '财务管理',
                href: '#parent5',
                tags: ['0'],
                nodes: [
                    {
                        text: '待结算流水',
                        href: '#child18',
                        tags: ['2'],
                    },
                    {
                        text: '已结算流水',
                        href: '#child19',
                        tags: ['2'],
                    },
                    {
                        text: '已返款流水',
                        href: '#child20',
                        tags: ['2'],
                    },
                    {
                        text: '财务返款单',
                        href: '#child21',
                        tags: ['2'],
                    },
                    {
                        text: '支付宝记录',
                        href: '#child22',
                        tags: ['2'],
                    },
                ]
            },
            {
                text: '用户管理',
                href: '#parent6'  ,
                tags: ['0'],
                nodes: [
                    {
                        text: '基本信息',
                        href: '#child23',
                        tags: ['2'],
                    },
                    {
                        text: '修改密码',
                        href: '#child24',
                        tags: ['2'],
                    }
                ]
            }
        ];
            $("#functree").treeview({
                levels:1,
                showTags:true,
                data:data
            });

            /*默认选择指定的item*/
            $('#functree').treeview('selectNode', [11, { silent: true }]);
            /*展开指定的item*/
            $('#functree').treeview('expandNode',[8, {silent:true, ignoreChildren: false}]);
            /*点击事件*/
            $("#functree").on("nodeSelected",function(event,data){
                    $("#content").load(data.href);
            });
    });
</script>
</body>
</html>